/*
 * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_STA_DEFINE_H
#define OHOS_STA_DEFINE_H

#include <functional>
#include <string>

namespace OHOS {
namespace Wifi {
#define FRIEND_GTEST(test_typename) friend class test_typename##Test

#define WIFI_SVR_CMD_STA_ENABLE_STA 0x2001
#define WIFI_SVR_CMD_STA_DISABLE_STA 0x2002
#define WIFI_SVR_CMD_STA_OPERATIONAL_MODE 0x2003
#define WIFI_SVR_CMD_STA_CONNECT_NETWORK 0x2004
#define WIFI_SVR_CMD_STA_CONNECT_SAVED_NETWORK 0x2005
#define WIFI_SVR_CMD_STA_RECONNECT_NETWORK 0x2006
#define WIFI_SVR_CMD_STA_REASSOCIATE_NETWORK 0x2007
#define WIFI_SVR_CMD_STA_DISCONNECT 0x2008
#define WIFI_SVR_CMD_STA_STARTWPS 0x2009
#define WIFI_SVR_CMD_STA_CANCELWPS 0x200A
#define WIFI_SVR_COM_STA_START_ROAM 0x200B
#define WIFI_SVR_COM_STA_ENABLE_HILINK 0x200C
#define WIFI_SVR_COM_STA_HILINK_DELIVER_MAC 0x200D
#define WIFI_SVR_COM_STA_HILINK_TRIGGER_WPS 0x200E
#define WIFI_SVR_COM_STA_NETWORK_REMOVED 0x200F

#define WIFI_SVR_CMD_STA_ERROR 0x3001
#define WIFI_SVR_CMD_STA_SUP_CONNECTION_EVENT 0x3002
#define WIFI_SVR_CMD_STA_SUP_DISCONNECTION_EVENT 0x3003
#define WIFI_SVR_CMD_STA_NETWORK_CONNECTION_EVENT 0x3004
#define WIFI_SVR_CMD_STA_NETWORK_DISCONNECTION_EVENT 0x3005
#define WIFI_SVR_CMD_STA_WPS_START_EVENT 0x3006
#define WIFI_SVR_CMD_STA_WPS_CANCEL_EVENT 0x3007
#define WIFI_SVR_CMD_STA_WPS_FAILED_EVENT 0x3008
#define WIFI_SVR_CMD_STA_WPS_OVERLAP_EVENT 0x3009
#define WIFI_SVR_CMD_STA_WPS_TIMEOUT_EVNET 0x300A
#define WIFI_SVR_CMD_STA_WPS_WEP_PROHIBITED 0x300B
#define WIFI_SVR_CMD_STA_WPS_TKIP_ONLY_PROHIBITED 0x300C
#define WIFI_SVR_CMD_STA_WPS_AUTH_FAILURE 0x300D
#define WIFI_SVR_CMD_STA_WPS_OVERLAP_ERROR 0x300E
#define WIFI_SVR_CMD_STA_SUP_REQUEST_IDENTITY 0x300F
#define WIFI_SVR_CMD_STA_SUP_REQUEST_SIM_AUTH 0x3010
#define WIFI_SVR_CMD_STA_AUTHENTICATION_FAILURE_EVENT 0x3011
#define WIFI_SVR_CMD_STA_REASON_TKIP_ONLY_PROHIBITED 0x3012
#define WIFI_SVR_CMD_STA_REASON_WEP_PROHIBITED 0x3013
#define WIFI_SVR_CMD_STA_CONFIG_AUTH_FAILURE 0x3014
#define WIFI_SVR_CMD_STA_CONFIG_MULTIPLE_PBC_DETECTED 0x3015
#define WIFI_SVR_CMD_STA_WPA_STATE_CHANGE_EVENT 0x3016
#define WIFI_SVR_CMD_STA_WPA_PASSWD_WRONG_EVENT 0x3017
#define WIFI_SVR_CMD_STA_WPA_FULL_CONNECT_EVENT 0x3018
#define WIFI_SVR_CMD_STA_WPA_ASSOC_REJECT_EVENT 0x3019
#define WIFI_SVR_CMD_STA_BSSID_CHANGED_EVENT 0x301A
#define WIFI_SVR_CMD_STA_DHCP_RESULT_NOTIFY_EVENT 0x301B
#define WIFI_SVR_CMD_STA_NET_DETECTION_NOTIFY_EVENT 0x301C
#define WIFI_SVR_CMD_STA_WPA_EAP_SIM_AUTH_EVENT 0x301D
#define WIFI_SVR_CMD_STA_WPA_EAP_UMTS_AUTH_EVENT 0x301E
#define WIFI_SVR_CMD_STA_REPORT_DISCONNECT_REASON_EVENT 0x301F
#define WIFI_SVR_CMD_STA_PORTAL_BROWSE_NOTIFY_EVENT 0x3020
#define WIFI_SVR_CMD_STA_LINK_SWITCH_EVENT 0x3021
#define WIFI_SVR_CMD_STA_CSA_CHANNEL_SWITCH_EVENT 0x3022
#define WIFI_SVR_CMD_STA_MLO_WORK_STATE_EVENT 0x3023
#define WIFI_SVR_CMD_STA_FOREGROUND_APP_CHANGED_EVENT 0x3024
#define WIFI_SVR_CMD_STA_WPA_EAP_CUSTOM_AUTH_EVENT 0x3025

#define WPA_BLOCK_LIST_CLEAR_EVENT 0x4001
#define WIFI_SVR_CMD_UPDATE_COUNTRY_CODE 0x4002
#define WIFI_SCREEN_STATE_CHANGED_NOTIFY_EVENT 0x4003
#define WIFI_AUDIO_STATE_CHANGED_NOTIFY_EVENT 0x4004
#define WIFI_BATTERY_STATE_CHANGED_NOTIFY_EVENT 0x4005

#define WIFI_SVR_CMD_STA_FOLD_STATUS_NOTIFY_EVENT 0x5001
#define BSSID_LEN 17
#define KEY_LEN 128
#define SSID_LEN 32
#define VALUE_LIMIT_MIN_RSSI (-100)
#define VALUE_LIMIT_MAX_RSSI (-55)

#define AUDIO_OFF (0)
#define AUDIO_ON_VOIP (1)
#define AUDIO_ON_AUDIO (2)

enum SelectedType {
    NETWORK_SELECTED_BY_UNKNOWN = -1,
    NETWORK_SELECTED_BY_AUTO = 0,
    NETWORK_SELECTED_BY_USER = 1,
    NETWORK_SELECTED_BY_RETRY = 2,
    NETWORK_SELECTED_BY_WIFIPRO = 3,
    NETWORK_SELECTED_BY_SELFCURE = 4,
    NETWORK_SELECTED_BY_ROAM = 5,
    NETWORK_SELECTED_BY_REASSOC = 6,
    NETWORK_SELECTED_BY_MDM = 7
};

#define WIFI_SIM_GSM_AUTH_MIN_PARAM_COUNT 3
#define WIFI_SIM_GSM_AUTH_MAX_PARAM_COUNT 4
#define WIFI_SIM_UMTS_AUTH_PARAM_COUNT 3

#define WIFI_MLO_STATE_PARAM_COUNT 3

inline const int NETWORK_24G_BAND = 1;
inline const int NETWORK_5G_BAND = 2;
inline const int MAX_RETRY_COUNT = 3;
#define BAND_2_G 1
#define BAND_5_G 2

typedef enum EnumStaArpState {
    ARP_STATE_WORKING,
    ARP_STATE_UNREACHABLE,
} StaArpState;

enum NetworkFailReason {
    DNS_STATE_WORKING,
    DNS_STATE_UNREACHABLE,
    IP_STATE_CONFLICT,
    IPV6_STATE_UNREACHABLE,
};

typedef enum EnumNetWorkState {
    NETWORK_NOTWORKING,
    NETWORK_IS_WORKING,
    NETWORK_IS_PORTAL,
    NETWORK_DEFAULT_STATE,
}SystemNetWorkState;

typedef enum EnumStaNetState {
    NETWORK_STATE_UNKNOWN,
    NETWORK_STATE_WORKING,
    NETWORK_CHECK_PORTAL,
    NETWORK_STATE_NOINTERNET,
    NETWORK_STATE_BUTT,
} StaNetState;

using ArpStateHandler = std::function<void(StaArpState arpState)>;
}  // namespace Wifi
}  // namespace OHOS
#endif /* OHOS_STA_DEFINE_H */
